﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace FinalCRM.Mary_s_Modules
{
    public partial class Documents : System.Web.UI.Page
    {
      

        protected void btnDocSave_Click(object sender, EventArgs e)
        {

            DocumentObj d = new DocumentObj();
            if (fUPFileName.HasFile)
            {
                d.FileName = fUPFileName.FileName;
                String path = Server.MapPath("~/Saves/");
                fUPFileName.SaveAs(path + d.FileName);
            }
            d.DocName = txtBoxDocName.Text;
            d.DocType = txtBoxDocType.Text;

            //d.DateCreated = Convert.ToString(dateEditDoc.Text);
            d.UserName = txtBoxDocAssignBy.Text;
            d.CustomerName = ddlDocRelatedCus.SelectedValue;
            d.Description = txtBoxUpDocDes.Text;
            //DocumentObj.CreateDoc(d);
            //lblsuccess.Text= "Document Created Successfully";
            
            }
        

        protected void txtBoxDocDate_TextChanged(object sender, EventArgs e)
        {
           // string docDate = DocCalendar.SelectedDate.ToString();
        //    txtBoxDocDate.Text = docDate;          
        }

        protected void PgCtrlDocument_ActiveTabChanged(object source, DevExpress.Web.ASPxTabControl.TabControlEventArgs e)
        {

        }

        protected void txtBoxDocType_TextChanged(object sender, EventArgs e)
        {

        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void PgCtrlDocument_Load(object sender, EventArgs e)
        {
            txtBoxDocDate.Text = DateTime.Now.ToString();
        }

        protected void GVDocView_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
        {
            string docName = e.Parameters.ToString();
            GVDocView.Selection.UnselectAll();
            for (int i = 0; i < GVDocView.VisibleRowCount; i++) 
            {
                if (GVDocView.GetRowValues(i, "File Name") != null)
                {
                    if (GVDocView.GetRowValues(i, "File Name").ToString() == docName)
                    {
                        GVDocView.Selection.SelectRow(i);
                    }
                }
            }
        }

        protected void BtnEditSearchDoc_TextChanged(object sender, EventArgs e)
        {

        }

        protected void GVDocView_RowCommand(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewRowCommandEventArgs e)
        {
            if(e. == "Select")

        }


        
    }
}